package com.nuaa.controller.announcement;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.nuaa.controller.base.BaseController;
import com.nuaa.domain.announcement.AnnounceEntity;
import com.nuaa.service.announcement.inter.AnnounceServiceInter;
/**
 * @author heaven
 * 通知通告
 */
@Controller
@RequestMapping("/announce")
public class AnnounceController extends BaseController{
	@Resource(name="announceService")
	private AnnounceServiceInter announceService;
	/**返回设置页面*/
	@RequestMapping("/show_set")
	public String getSetPage(int id){
		if(id==1){
			return "announcement/order_set";
		}else{
			return "announcement/handle_set";
		}
	}
	/**提交通告*/
	@RequestMapping("/submit.do")
	public void submitAnnoun(HttpServletResponse response,AnnounceEntity anEntity){
		System.out.println(anEntity.getContent());
		this.writeJson(response, announceService.subAnnounceInfo(anEntity));
	}
	/**客户端获取最新通告页面（右边窗口）*/
	@RequestMapping("/recentPage")
	public String getCustomerAnnoPage(){
		return "announcement/recentAnnoun";
	}
	/**获取所有通告信息*/
	@RequestMapping("/getAllInfo.do")
	public void getAllAnnoun(HttpServletResponse response){
		this.writeJson(response, announceService.getAllInfo());
	}
	@RequestMapping("/mainpage")
	public String getMainPage(){
		return "announcement/mainpage";
	}
}
